package com.sz.common.pay.pingan.constant;

/**
 * Function: 文件操作常量 <br>
 *
 * @author: siqishangshu <br>
 * @date: 2017-11-29 13:46:00
 */
public class FileConstant {
    public static final String XML_VERSION_ENCODEING = "<?xml version=\"1.0\" encoding=\""+Constant.CHARSET_GBK.toUpperCase()+"\"?>";
    public static final String XML_ROOT = "Result";
    public static final String XML_LE = "<";
    public static final String XML_RI = ">";
    public static final String XML_E = "/";
    public static final String FILE_PATH = "PA/";

    /**
     * 交易码	 功能码   功能描述	                    场景
     * FILE01	   01    文件上传	                    客户ERP请求B2BiC
     * FILE02	   02    文件上传和下载进度查询	        客户ERP请求B2BiC
     * FILE03	   03    文件下载	                    客户ERP请求B2BiC
     * FILE04	   04    通知客户ERP文件上传、下载结果	B2BiC请求客户ERP
     */
    public class TradeCode {
        public static final String UPLOAD = "FILE01";
        public static final String PROGRESS = "FILE02";
        public static final String DOWNLOAD = "FILE03";
        public static final String RESULT = "FILE04";
    }

    /**
     * 文件上传按顺序有如下状态
     * 状态码	描述          	    后续状态	            阶段错误码
     * U1	    接收文件上传请求	    U2、U3、U4、U5、F0	E1、E2
     * U2	    从企业FTP服务器取文件	U3、U4、U5、F0	    E6
     * U3	    文件签名、加密	    U4、U5、F0	        E3、E4
     * U4	    文件上传银行中	    F0、U5	            E5
     * F0	    文件传输成功
     * U5	    发送通知	            F0	                E7
     */
    public class UpStatus {
        public static final String UPLOAD_REQUEST = "U1";
        public static final String READ_FROM_FTP = "U2";
        public static final String FILE_SIGNATURE_ENCRYPT = "U3";
        public static final String UPLOADING_TO_BANK = "U4";
        public static final String TRANSFER_SUCCEED = "F4";
        public static final String SEND_NOTICE = "U5";
    }

    /**
     * 文件下载按顺序有如下状态
     * 状态码	描述	                    后续状态	            阶段错误码
     * D1	    接收文件下载请求	        D2、D3、D4、D5、F0
     * D2	    从银行下载文件	        D3、D4、D5、F0	    E5
     * D3	    文件解密、验签	        D4、D5、F0	        E3、E1、E4
     * D4	    将文件传至企业FTP服务器	D5、F0	            E6
     * D5	    发送通知	                F0	                E7
     * F0	    文件传输成功	            E7	                E7
     * E7	    发送通知失败（文件上传、下载成功）	此问题原因是企业没有配置监听服务，可以忽略
     */
    public class OrderStatus {
        public static final String DOWNLOAD_REQUEST = "D1";
        public static final String DOWNLOAD_FROM_BANK = "D2";
        public static final String FILE_DECRYPT_INSPECTION = "D3";
        public static final String UPLOADING_TO_FTP = "D4";
        public static final String SEND_NOTICE = "D5";
        public static final String TRANSFER_SUCCEED = "F0";
        public static final String TRANSFER_FAILED = "E7";
    }

    /**
     * 文件传输错误码
     * 状态码	    描述
     * E1	    文件大小不符
     * E2	    文件不存在
     * E3	    加解密失败
     * E4	    签名、验证失败
     * E5	    与银行传文失败
     * E6	    与企业Ftp传文失败
     * E7	    发送FILE04通知失败
     */
    public class ErrorCode {
        public static final String SIZE_NOT_SAME = "E1";
        public static final String NOT_EXISTS = "E2";
        public static final String EN_DE_CRYPT_FAILED = "E3";
        public static final String SIGNATURE_FAILED = "E4";
        public static final String TRANSFER_BANK_FAILED = "E5";
        public static final String TRANSFER_FTP_FAILED = "E6";
        public static final String SEND_FILE04_NOTICE_FAILED = "E7";
    }

    /**
     * Action	    上传下载类型	C(1)	必输	    "1:上传；2:下载"
     */
    public class Action {
        public static final String UPLOAD = "1";
        public static final String DOWNLOAD = "2";
    }
}
